/*
 * MockDefinitions.h
 *
 *  Created on: Nov 3, 2012
 *      Author: Federico Orquera
 */

#ifndef MOCKDEFINITIONS_H_
#define MOCKDEFINITIONS_H_

#include "../bplusnodes/NewInternal.h"

typedef std::string BPTkey_t;
typedef std::string BPTvalue_t;

#define ORDER 		500
#define LEAF_LEVEL	0

extern BPTkey_t cropKey_func(const BPTkey_t& key, const BPTkey_t& prevKey);
extern bool keyComparator_func (const BPTkey_t& key1, const BPTkey_t& key2);

typedef NewNode     <BPTkey_t, BPTvalue_t, keyComparator_func>    Node;
typedef NewLeaf     <BPTkey_t, BPTvalue_t, keyComparator_func>    Leaf;
typedef NewInternal <BPTkey_t, BPTvalue_t, keyComparator_func>    Internal;

typedef std::shared_ptr< Node > node_ptr;

typedef typename Node::NodeOrder    NodeOrder_t;
typedef typename Node::NodeLevel    NodeLevel_t;
typedef typename Node::NodeID       NodeID_t;
typedef typename Node::searchResult searchResult_t;

typedef typename Leaf::registerType         	LeafRegister_t;
typedef typename Leaf::register_ptr         	LeafRegister_ptr;
typedef typename Leaf::registerPointerList  	LeafRegisterList_t;
typedef typename Leaf::registerPointerList_ptr	LeafRegisterList_ptr;

extern bool isOverflowLeaf_func (const LeafRegisterList_t& list);
extern bool isUnderflowLeaf_func(const LeafRegisterList_t& list);

struct LeafSerializationBlock
{
    NodeID_t rightSibling;
    LeafRegisterList_ptr content;
};

typedef typename Internal::InternalRegisterType     		InternalRegister_t;
typedef typename Internal::InternalRegister_ptr     		InternalRegister_ptr;
typedef typename Internal::InternalRegisterPointerList		InternalRegisterList_t;
typedef typename Internal::InternalRegisterPointerList_ptr	InternalRegisterList_ptr;

extern bool isOverflowInternal_func (const InternalRegisterList_t& list);
extern bool isUnderflowInternal_func(const InternalRegisterList_t& list);

struct InternalSerializationBlock
{
    NodeID_t    firstChild;
    NodeLevel_t level;
    InternalRegisterList_ptr content;
};


#endif /* MOCKDEFINITIONS_H_ */
